﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Windows.WorkFlow.Domain;

namespace Windows.WorkFlow.Infrastructure.EFCore.Mappings
{
    public class TaskMapping : IEntityTypeConfiguration<Domain.Task>
    {
        public void Configure(EntityTypeBuilder<Domain.Task> builder)
        {
            builder.Property(x => x.NodeId).HasMaxLength(50);
            builder.Property(x => x.NodeName).HasMaxLength(50);
            builder.Property(x => x.AssigneeId);
            builder.Property(x => x.AssigneeName).HasMaxLength(50);
            builder.Property(x => x.OwnerId).IsRequired(false);
            builder.Property(x => x.OwnerName).IsRequired(false);
            builder.Property(x => x.Status);
            builder.Property(x => x.Comment).IsRequired(false).HasMaxLength(500);
            builder.Property(x => x.StartOn).HasColumnType("datetime");
            builder.Property(x => x.EndOn).IsRequired(false).HasColumnType("datetime");
            builder.Property(x => x.ExecutionId);
        }
    }
}
